home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 34
/
Amiga Format CD34 (1998-11-20)(Future Publishing)(GB)[!][Christmas issue].iso
/
-seriously_amiga-
/
programming
/
c
/
mesa-2.6
/
src
/
api1.c
next >
Wrap
C/C++ Source or Header
|
1998-10-01
|
53KB
|
2,018 lines
/* $Id: api1.c,v 1.3 1997/11/05 03:25:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 2.5
* Copyright (C) 1995-1997 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* api1.c
*
* Version 1.0 27 Jun 1998
* by Jarno van der Linden
* jarno@kcbbs.gen.nz
*
* File created from api1.c ver 1.3 and gl.h ver 1.26 using GenProtos
*
*/
#ifdef PC_HEADER
#include "all.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include "api.h"
#include "bitmap.h"
#include "context.h"
#include "drawpix.h"
#include "eval.h"
#include "image.h"
#include "macros.h"
#include "matrix.h"
#include "teximage.h"
#include "types.h"
#include "vb.h"
#endif
__asm __saveds void APIENTRY glAccum( register __d0 GLenum op, register __fp0 GLfloat value )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.Accum)(CC, op, value);
}
__asm __saveds void APIENTRY glAlphaFunc( register __d0 GLenum func, register __fp0 GLclampf ref )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.AlphaFunc)(CC, func, ref);
}
__asm __saveds GLboolean APIENTRY glAreTexturesResident( register __d0 GLsizei n, register __a0 const GLuint *textures,
register __a1 GLboolean *residences )
{
GET_CONTEXT;
CHECK_CONTEXT_RETURN(GL_FALSE);
return (*CC->API.AreTexturesResident)(CC, n, textures, residences);
}
__asm __saveds void APIENTRY glArrayElement( register __d0 GLint i )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.ArrayElement)(CC, i);
}
__asm __saveds void APIENTRY glBegin( register __d0 GLenum mode )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.Begin)( CC, mode );
}
__asm __saveds void APIENTRY glBindTexture( register __d0 GLenum target, register __d1 GLuint texture )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.BindTexture)(CC, target, texture);
}
__asm __saveds void APIENTRY glBitmapA(register __a0 void *vargs)
{
struct glBitmapArgs {
GLsizei width;
GLsizei height;
GLfloat xorig;
GLfloat yorig;
GLfloat xmove;
GLfloat ymove;
GLubyte *bitmap;
} *args;
args = (struct glBitmapArgs *)vargs;
glBitmap(args->width, args->height, args->xorig, args->yorig, args->xmove, args->ymove, args->bitmap);
}
__asm __saveds void APIENTRY glBitmap( register __d0 GLsizei width, register __d1 GLsizei height,
register __fp0 GLfloat xorig, register __fp1 GLfloat yorig,
register __fp2 GLfloat xmove, register __fp3 GLfloat ymove,
register __a0 const GLubyte *bitmap )
{
GET_CONTEXT;
CHECK_CONTEXT;
if (!CC->CompileFlag) {
/* execute only, try optimized case where no unpacking needed */
if ( CC->Unpack.LsbFirst==GL_FALSE
&& CC->Unpack.Alignment==1
&& CC->Unpack.RowLength==0
&& CC->Unpack.SkipPixels==0
&& CC->Unpack.SkipRows==0) {
/* Special case: no unpacking needed */
struct gl_image image;
image.Width = width;
image.Height = height;
image.Components = 0;
image.Type = GL_BITMAP;
image.Format = GL_COLOR_INDEX;
image.Data = (GLvoid *) bitmap;
(*CC->Exec.Bitmap)( CC, width, height, xorig, yorig,
xmove, ymove, &image );
}
else {
struct gl_image *image;
image = gl_unpack_bitmap( CC, width, height, bitmap );
(*CC->Exec.Bitmap)( CC, width, height, xorig, yorig,
xmove, ymove, image );
if (image) {
gl_free_image( image );
}
}
}
else {
/* compile and maybe execute */
struct gl_image *image;
image = gl_unpack_bitmap( CC, width, height, bitmap );
(*CC->API.Bitmap)(CC, width, height, xorig, yorig, xmove, ymove, image );
}
}
__asm __saveds void APIENTRY glBlendFunc( register __d0 GLenum sfactor, register __d1 GLenum dfactor )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.BlendFunc)(CC, sfactor, dfactor);
}
__asm __saveds void APIENTRY glCallList( register __d0 GLuint list )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.CallList)(CC, list);
}
__asm __saveds void APIENTRY glCallLists( register __d0 GLsizei n, register __d1 GLenum type, register __a0 const GLvoid *lists )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.CallLists)(CC, n, type, lists);
}
__asm __saveds void APIENTRY glClear( register __d0 GLbitfield mask )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.Clear)(CC, mask);
}
__asm __saveds void APIENTRY glClearAccum( register __fp0 GLfloat red, register __fp1 GLfloat green,
register __fp2 GLfloat blue, register __fp3 GLfloat alpha )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.ClearAccum)(CC, red, green, blue, alpha);
}
__asm __saveds void APIENTRY glClearIndex( register __fp0 GLfloat c )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.ClearIndex)(CC, c);
}
__asm __saveds void APIENTRY glClearColor( register __fp0 GLclampf red,
register __fp1 GLclampf green,
register __fp2 GLclampf blue,
register __fp3 GLclampf alpha )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.ClearColor)(CC, red, green, blue, alpha);
}
__asm __saveds void APIENTRY glClearDepth( register __fp0 GLclampd depth )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.ClearDepth)( CC, depth );
}
__asm __saveds void APIENTRY glClearStencil( register __d0 GLint s )
{
GET_CONTEXT;
CHECK_CONTEXT;
(*CC->API.ClearStencil)(CC, s);
}
__asm __saveds void APIENTRY glClipPlane( register __d0 GLenum plane, register __a0 const GLdouble *equation )
{
GLfloat eq[4];
GET_CONTEXT;
CHECK_CONTEXT;
eq[0] = (GLfloat) equation[0];
eq[1] = (GLfloat) equation[1];
eq[2] = (GLfloat) equation[2];
eq[3] = (GLfloat) equation[3];
(*CC->API.ClipPlane)(CC, plane, eq );
}
__asm __saveds void APIENTRY glColor3b( register __d0 GLbyte red, register __d1 GLbyte green, register __d2 GLbyte blue )
{
GET_CONTEXT;
(*CC->API.Color3f)( CC, BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green),
BYTE_TO_FLOAT(blue) );
}
__asm __saveds void APIENTRY glColor3d( register __fp0 GLdouble red, register __fp1 GLdouble green, register __fp2 GLdouble blue )
{
GET_CONTEXT;
(*CC->API.Color3f)( CC, (GLfloat) red, (GLfloat) green, (GLfloat) blue );
}
__asm __saveds void APIENTRY glColor3f( register __fp0 GLfloat red, register __fp1 GLfloat green, register __fp2 GLfloat blue )
{
GET_CONTEXT;
(*CC->API.Color3f)( CC, red, green, blue );
}
__asm __saveds void APIENTRY glColor3i( register __d0 GLint red, register __d1 GLint green, register __d2 GLint blue )
{
GET_CONTEXT;
(*CC->API.Color3f)( CC, INT_TO_FLOAT(red), INT_TO_FLOAT(green),
INT_TO_FLOAT(blue) );
}
__asm __saveds void APIENTRY glColor3s( register __d0 GLshort red, register __d1 GLshort green, register __d2 GLshort blue )
{
GET_CONTEXT;
(*CC->API.Color3f)( CC, SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
SHORT_TO_FLOAT(blue) );
}
__asm __saveds void APIENTRY glColor3ub( register __d0 GLubyte red, register __d1 GLubyte green, register __d2 GLubyte blue )
{
GET_CONTEXT;
(*CC->API.Color4ub)( CC, red, green, blue, 255 );
}
__asm __saveds void APIENTRY glColor3ui( register __d0 GLuint red, register __d1 G